package aop.bean;

import org.aspectj.lang.ProceedingJoinPoint;

public class MyAspect {
    public void beforeAdvice(){
        System.out.println("MyAspect.beforeAdvice");
    }
    public void afterAdvice(){
        System.out.println("MyAspect.afterAdvice");
    }
    public void afterRetuningAdvice(Object returnVal){
        System.out.println("MyAspect.afterRetuningAdvice.returnVal:"+returnVal);
    }
    public void AfterThrowingAdvice(IllegalArgumentException exception){
        System.out.println("MyAspect.AfterThrowingAdvice.exception:" +exception.toString());
    }
    public Object aroundAdvice(ProceedingJoinPoint point) throws Throwable {
        System.out.println(point.getSignature().getName()+" 方法执行前");
        Object result = point.proceed(); //起点执行
        System.out.println(point.getSignature().getName()+" 方法执行后");
        return result;
    }
}
